package com.zhiyou100.servlet;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/*
作者：mtb
时间：2020年7月31日 上午10:32:04
班级：java26  天道酬勤 不忘初衷
*/
public class AjaxCountOneLine extends HttpServlet {
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		req.setCharacterEncoding("utf-8");//设置编码集
	     //获取在线人数
		int count=(Integer)req.getServletContext().getAttribute("onLineCount");
		resp.setCharacterEncoding("utf-8");//设置响应编码集
		resp.setContentType("text/html;charset=utf-8");
		resp.getWriter().print(count);
	}
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
	
	}
}
